package cn.ibizlab.odoo.core.odoo_fleet.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract;
import cn.ibizlab.odoo.core.odoo_fleet.domain.Fleet_vehicle_log_contract;
import cn.ibizlab.odoo.core.odoo_fleet.filter.Fleet_vehicle_log_contractSearchContext;
import cn.ibizlab.odoo.core.odoo_fleet.service.IFleet_vehicle_log_contractService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[车辆合同信息] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Fleet_vehicle_log_contractServiceImpl implements IFleet_vehicle_log_contractService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Ifleet_vehicle_log_contractClientService fleet_vehicle_log_contractClientService;

    @Override
    public Fleet_vehicle_log_contract get(Integer id) {
        Ifleet_vehicle_log_contract clientModel = fleet_vehicle_log_contractClientService.createModel();
        clientModel.setId(id);
        fleet_vehicle_log_contractClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Fleet_vehicle_log_contract get(Fleet_vehicle_log_contract fleet_vehicle_log_contract) {
        Fleet_vehicle_log_contract retfleet_vehicle_log_contract = this.get(fleet_vehicle_log_contract.getId()) ;
    	BeanCopier copier=BeanCopier.create(retfleet_vehicle_log_contract.getClass(), fleet_vehicle_log_contract.getClass(), false);
        copier.copy(retfleet_vehicle_log_contract, fleet_vehicle_log_contract, null);
        return fleet_vehicle_log_contract ;
    }

    @Override
    public void createBatch(List<Fleet_vehicle_log_contract> fleet_vehicle_log_contracts, int batchSize) {

                        //fleet_vehicle_log_contractClientService.createBatch(fleet_vehicle_log_contracts,batchSize) ;

    }

    @Override
    public boolean update(Fleet_vehicle_log_contract fleet_vehicle_log_contract) {
        boolean bOk = false ;
        Ifleet_vehicle_log_contract clientModel = this.convert2Model(fleet_vehicle_log_contract,null);
        fleet_vehicle_log_contractClientService.update(clientModel) ;
        this.convert2Domain(clientModel,fleet_vehicle_log_contract) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Ifleet_vehicle_log_contract clientModel = fleet_vehicle_log_contractClientService.createModel();
        clientModel.setId(id);
        fleet_vehicle_log_contractClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //fleet_vehicle_log_contractClientService.removeBatch(fleet_vehicle_log_contracts) ;

    }

    @Override
    public boolean create(Fleet_vehicle_log_contract fleet_vehicle_log_contract) {
        boolean bOk = false ;
        Ifleet_vehicle_log_contract clientModel = this.convert2Model(fleet_vehicle_log_contract,null);
        fleet_vehicle_log_contractClientService.create(clientModel) ;
        this.convert2Domain(clientModel,fleet_vehicle_log_contract);
        bOk = true ;

        return bOk ;
    }

    @Override
    public void updateBatch(List<Fleet_vehicle_log_contract> fleet_vehicle_log_contracts, int batchSize) {

        //fleet_vehicle_log_contractClientService.updateBatch(fleet_vehicle_log_contracts,batchSize) ;

    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Fleet_vehicle_log_contract> searchDefault(Fleet_vehicle_log_contractSearchContext context) {
        List<Fleet_vehicle_log_contract> list = new ArrayList<Fleet_vehicle_log_contract>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract> clientModelList = fleet_vehicle_log_contractClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle_log_contract>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据车辆相关的费用查询
     */
    @Override
    public Page<Fleet_vehicle_log_contract> selectByOdoo_cost(Integer id){
        Fleet_vehicle_log_contractSearchContext context = new Fleet_vehicle_log_contractSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle_log_contract> list = new ArrayList<Fleet_vehicle_log_contract>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract> clientModelList = fleet_vehicle_log_contractClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle_log_contract>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Fleet_vehicle_log_contract> selectByOdoo_insurer(Integer id){
        Fleet_vehicle_log_contractSearchContext context = new Fleet_vehicle_log_contractSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle_log_contract> list = new ArrayList<Fleet_vehicle_log_contract>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract> clientModelList = fleet_vehicle_log_contractClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle_log_contract>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Fleet_vehicle_log_contract> selectByOdoo_purchaser(Integer id){
        Fleet_vehicle_log_contractSearchContext context = new Fleet_vehicle_log_contractSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle_log_contract> list = new ArrayList<Fleet_vehicle_log_contract>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract> clientModelList = fleet_vehicle_log_contractClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle_log_contract>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Fleet_vehicle_log_contract> selectByOdoo_create(Integer id){
        Fleet_vehicle_log_contractSearchContext context = new Fleet_vehicle_log_contractSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle_log_contract> list = new ArrayList<Fleet_vehicle_log_contract>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract> clientModelList = fleet_vehicle_log_contractClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle_log_contract>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Fleet_vehicle_log_contract> selectByOdoo_user(Integer id){
        Fleet_vehicle_log_contractSearchContext context = new Fleet_vehicle_log_contractSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle_log_contract> list = new ArrayList<Fleet_vehicle_log_contract>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract> clientModelList = fleet_vehicle_log_contractClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle_log_contract>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Fleet_vehicle_log_contract> selectByOdoo_write(Integer id){
        Fleet_vehicle_log_contractSearchContext context = new Fleet_vehicle_log_contractSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle_log_contract> list = new ArrayList<Fleet_vehicle_log_contract>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract> clientModelList = fleet_vehicle_log_contractClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle_log_contract clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle_log_contract>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Ifleet_vehicle_log_contract convert2Model(Fleet_vehicle_log_contract domain , Ifleet_vehicle_log_contract model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = fleet_vehicle_log_contractClientService.createModel() ;
        }

         if(domain.getActivity_summaryDirtyFlag())
            model.setActivity_summary(domain.getActivity_summary());
         if(domain.getIns_refDirtyFlag())
            model.setIns_ref(domain.getIns_ref());
         if(domain.getActiveDirtyFlag())
            model.setActive(domain.getActive());
         if(domain.getSum_costDirtyFlag())
            model.setSum_cost(domain.getSum_cost());
         if(domain.getNotesDirtyFlag())
            model.setNotes(domain.getNotes());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getMessage_needaction_counterDirtyFlag())
            model.setMessage_needaction_counter(domain.getMessage_needaction_counter());
         if(domain.getExpiration_dateDirtyFlag())
            model.setExpiration_date(domain.getExpiration_date());
         if(domain.getMessage_partner_idsDirtyFlag())
            model.setMessage_partner_ids(domain.getMessage_partner_ids());
         if(domain.getMessage_has_errorDirtyFlag())
            model.setMessage_has_error(domain.getMessage_has_error());
         if(domain.getActivity_type_idDirtyFlag())
            model.setActivity_type_id(domain.getActivity_type_id());
         if(domain.getMessage_unread_counterDirtyFlag())
            model.setMessage_unread_counter(domain.getMessage_unread_counter());
         if(domain.getActivity_user_idDirtyFlag())
            model.setActivity_user_id(domain.getActivity_user_id());
         if(domain.getDays_leftDirtyFlag())
            model.setDays_left(domain.getDays_left());
         if(domain.getMessage_channel_idsDirtyFlag())
            model.setMessage_channel_ids(domain.getMessage_channel_ids());
         if(domain.getMessage_follower_idsDirtyFlag())
            model.setMessage_follower_ids(domain.getMessage_follower_ids());
         if(domain.getOdometerDirtyFlag())
            model.setOdometer(domain.getOdometer());
         if(domain.getStateDirtyFlag())
            model.setState(domain.getState());
         if(domain.getCost_idsDirtyFlag())
            model.setCost_ids(domain.getCost_ids());
         if(domain.getMessage_unreadDirtyFlag())
            model.setMessage_unread(domain.getMessage_unread());
         if(domain.getCost_generatedDirtyFlag())
            model.setCost_generated(domain.getCost_generated());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getWebsite_message_idsDirtyFlag())
            model.setWebsite_message_ids(domain.getWebsite_message_ids());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getMessage_idsDirtyFlag())
            model.setMessage_ids(domain.getMessage_ids());
         if(domain.getMessage_is_followerDirtyFlag())
            model.setMessage_is_follower(domain.getMessage_is_follower());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getMessage_needactionDirtyFlag())
            model.setMessage_needaction(domain.getMessage_needaction());
         if(domain.getMessage_main_attachment_idDirtyFlag())
            model.setMessage_main_attachment_id(domain.getMessage_main_attachment_id());
         if(domain.getMessage_has_error_counterDirtyFlag())
            model.setMessage_has_error_counter(domain.getMessage_has_error_counter());
         if(domain.getGenerated_cost_idsDirtyFlag())
            model.setGenerated_cost_ids(domain.getGenerated_cost_ids());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getCost_frequencyDirtyFlag())
            model.setCost_frequency(domain.getCost_frequency());
         if(domain.getStart_dateDirtyFlag())
            model.setStart_date(domain.getStart_date());
         if(domain.getActivity_stateDirtyFlag())
            model.setActivity_state(domain.getActivity_state());
         if(domain.getMessage_attachment_countDirtyFlag())
            model.setMessage_attachment_count(domain.getMessage_attachment_count());
         if(domain.getActivity_date_deadlineDirtyFlag())
            model.setActivity_date_deadline(domain.getActivity_date_deadline());
         if(domain.getActivity_idsDirtyFlag())
            model.setActivity_ids(domain.getActivity_ids());
         if(domain.getVehicle_idDirtyFlag())
            model.setVehicle_id(domain.getVehicle_id());
         if(domain.getAuto_generatedDirtyFlag())
            model.setAuto_generated(domain.getAuto_generated());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getOdometer_idDirtyFlag())
            model.setOdometer_id(domain.getOdometer_id());
         if(domain.getCost_typeDirtyFlag())
            model.setCost_type(domain.getCost_type());
         if(domain.getParent_idDirtyFlag())
            model.setParent_id(domain.getParent_id());
         if(domain.getPurchaser_id_textDirtyFlag())
            model.setPurchaser_id_text(domain.getPurchaser_id_text());
         if(domain.getCost_subtype_idDirtyFlag())
            model.setCost_subtype_id(domain.getCost_subtype_id());
         if(domain.getCost_amountDirtyFlag())
            model.setCost_amount(domain.getCost_amount());
         if(domain.getAmountDirtyFlag())
            model.setAmount(domain.getAmount());
         if(domain.getInsurer_id_textDirtyFlag())
            model.setInsurer_id_text(domain.getInsurer_id_text());
         if(domain.getCost_id_textDirtyFlag())
            model.setCost_id_text(domain.getCost_id_text());
         if(domain.getDescriptionDirtyFlag())
            model.setDescription(domain.getDescription());
         if(domain.getUser_id_textDirtyFlag())
            model.setUser_id_text(domain.getUser_id_text());
         if(domain.getDateDirtyFlag())
            model.setDate(domain.getDate());
         if(domain.getOdometer_unitDirtyFlag())
            model.setOdometer_unit(domain.getOdometer_unit());
         if(domain.getContract_idDirtyFlag())
            model.setContract_id(domain.getContract_id());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
         if(domain.getCost_idDirtyFlag())
            model.setCost_id(domain.getCost_id());
         if(domain.getInsurer_idDirtyFlag())
            model.setInsurer_id(domain.getInsurer_id());
         if(domain.getUser_idDirtyFlag())
            model.setUser_id(domain.getUser_id());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getPurchaser_idDirtyFlag())
            model.setPurchaser_id(domain.getPurchaser_id());
        return model ;
    }

    public Fleet_vehicle_log_contract convert2Domain( Ifleet_vehicle_log_contract model ,Fleet_vehicle_log_contract domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Fleet_vehicle_log_contract();
        }

        if(model.getActivity_summaryDirtyFlag())
            domain.setActivity_summary(model.getActivity_summary());
        if(model.getIns_refDirtyFlag())
            domain.setIns_ref(model.getIns_ref());
        if(model.getActiveDirtyFlag())
            domain.setActive(model.getActive());
        if(model.getSum_costDirtyFlag())
            domain.setSum_cost(model.getSum_cost());
        if(model.getNotesDirtyFlag())
            domain.setNotes(model.getNotes());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getMessage_needaction_counterDirtyFlag())
            domain.setMessage_needaction_counter(model.getMessage_needaction_counter());
        if(model.getExpiration_dateDirtyFlag())
            domain.setExpiration_date(model.getExpiration_date());
        if(model.getMessage_partner_idsDirtyFlag())
            domain.setMessage_partner_ids(model.getMessage_partner_ids());
        if(model.getMessage_has_errorDirtyFlag())
            domain.setMessage_has_error(model.getMessage_has_error());
        if(model.getActivity_type_idDirtyFlag())
            domain.setActivity_type_id(model.getActivity_type_id());
        if(model.getMessage_unread_counterDirtyFlag())
            domain.setMessage_unread_counter(model.getMessage_unread_counter());
        if(model.getActivity_user_idDirtyFlag())
            domain.setActivity_user_id(model.getActivity_user_id());
        if(model.getDays_leftDirtyFlag())
            domain.setDays_left(model.getDays_left());
        if(model.getMessage_channel_idsDirtyFlag())
            domain.setMessage_channel_ids(model.getMessage_channel_ids());
        if(model.getMessage_follower_idsDirtyFlag())
            domain.setMessage_follower_ids(model.getMessage_follower_ids());
        if(model.getOdometerDirtyFlag())
            domain.setOdometer(model.getOdometer());
        if(model.getStateDirtyFlag())
            domain.setState(model.getState());
        if(model.getCost_idsDirtyFlag())
            domain.setCost_ids(model.getCost_ids());
        if(model.getMessage_unreadDirtyFlag())
            domain.setMessage_unread(model.getMessage_unread());
        if(model.getCost_generatedDirtyFlag())
            domain.setCost_generated(model.getCost_generated());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getWebsite_message_idsDirtyFlag())
            domain.setWebsite_message_ids(model.getWebsite_message_ids());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getMessage_idsDirtyFlag())
            domain.setMessage_ids(model.getMessage_ids());
        if(model.getMessage_is_followerDirtyFlag())
            domain.setMessage_is_follower(model.getMessage_is_follower());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getMessage_needactionDirtyFlag())
            domain.setMessage_needaction(model.getMessage_needaction());
        if(model.getMessage_main_attachment_idDirtyFlag())
            domain.setMessage_main_attachment_id(model.getMessage_main_attachment_id());
        if(model.getMessage_has_error_counterDirtyFlag())
            domain.setMessage_has_error_counter(model.getMessage_has_error_counter());
        if(model.getGenerated_cost_idsDirtyFlag())
            domain.setGenerated_cost_ids(model.getGenerated_cost_ids());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getCost_frequencyDirtyFlag())
            domain.setCost_frequency(model.getCost_frequency());
        if(model.getStart_dateDirtyFlag())
            domain.setStart_date(model.getStart_date());
        if(model.getActivity_stateDirtyFlag())
            domain.setActivity_state(model.getActivity_state());
        if(model.getMessage_attachment_countDirtyFlag())
            domain.setMessage_attachment_count(model.getMessage_attachment_count());
        if(model.getActivity_date_deadlineDirtyFlag())
            domain.setActivity_date_deadline(model.getActivity_date_deadline());
        if(model.getActivity_idsDirtyFlag())
            domain.setActivity_ids(model.getActivity_ids());
        if(model.getVehicle_idDirtyFlag())
            domain.setVehicle_id(model.getVehicle_id());
        if(model.getAuto_generatedDirtyFlag())
            domain.setAuto_generated(model.getAuto_generated());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getOdometer_idDirtyFlag())
            domain.setOdometer_id(model.getOdometer_id());
        if(model.getCost_typeDirtyFlag())
            domain.setCost_type(model.getCost_type());
        if(model.getParent_idDirtyFlag())
            domain.setParent_id(model.getParent_id());
        if(model.getPurchaser_id_textDirtyFlag())
            domain.setPurchaser_id_text(model.getPurchaser_id_text());
        if(model.getCost_subtype_idDirtyFlag())
            domain.setCost_subtype_id(model.getCost_subtype_id());
        if(model.getCost_amountDirtyFlag())
            domain.setCost_amount(model.getCost_amount());
        if(model.getAmountDirtyFlag())
            domain.setAmount(model.getAmount());
        if(model.getInsurer_id_textDirtyFlag())
            domain.setInsurer_id_text(model.getInsurer_id_text());
        if(model.getCost_id_textDirtyFlag())
            domain.setCost_id_text(model.getCost_id_text());
        if(model.getDescriptionDirtyFlag())
            domain.setDescription(model.getDescription());
        if(model.getUser_id_textDirtyFlag())
            domain.setUser_id_text(model.getUser_id_text());
        if(model.getDateDirtyFlag())
            domain.setDate(model.getDate());
        if(model.getOdometer_unitDirtyFlag())
            domain.setOdometer_unit(model.getOdometer_unit());
        if(model.getContract_idDirtyFlag())
            domain.setContract_id(model.getContract_id());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        if(model.getCost_idDirtyFlag())
            domain.setCost_id(model.getCost_id());
        if(model.getInsurer_idDirtyFlag())
            domain.setInsurer_id(model.getInsurer_id());
        if(model.getUser_idDirtyFlag())
            domain.setUser_id(model.getUser_id());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getPurchaser_idDirtyFlag())
            domain.setPurchaser_id(model.getPurchaser_id());
        return domain ;
    }


}
